<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 2017/9/29
 * Time: 上午 10:14
 */

namespace wodrow\models;


use ActiveRecord\Model;

/**
 * Class Estimate
 * @package wodrow\models
 *
 *
 * @property integer $et_id
 * @property string $et_name
 * @property string $et_code
 * @property string $et_car_type
 * @property string $et_car_model
 * @property string $et_bank
 * @property string $et_car_date
 * @property string $et_remarks
 * @property string $et_remarks_two
 * @property integer $et_br_id
 * @property string $et_br_name
 * @property integer $et_sid
 * @property string $et_sname
 * @property integer $et_stime
 * @property integer $et_stime_two
 * @property integer $et_ftime
 * @property integer $et_fid
 * @property string $et_fname
 * @property string $et_price
 * @property string $et_status
 * @property string $et_o_number
 * @property string $et_attach
 * @property string $et_fremarks
 * @property string $et_price_one
 * @property string $et_price_two
 */
class Estimate extends Model
{
    public static $table_name = "dyhl_estimate";

    public $et_carprice;
    public $et_loan;
    public $et_rate;

    public static $validates_presence_of = array(
        array('et_name'),
        array('et_code'),
        array('et_car_type'),
        array('et_car_model'),
        array('et_bank'),
        array('et_car_date'),
        array('et_remarks'),
        array('et_br_id'),
        array('et_br_name'),
        array('et_sid'),
        array('et_sname'),
        array('et_stime'),
        array('et_stime_two'),
//        array('et_ftime'),
//        array('et_fid'),
        array('et_carprice'),
        array('et_loan'),
        array('et_rate'),
        //array('et_seat_number'),
        //array('et_car_fullmodel'),
    );

    public function getThreeValue()
    {
        preg_match_all("/[\d\.]+/s", $this->et_remarks, $t);
        $this->et_carprice = $t[0][0];
        $this->et_loan = $t[0][1];
        $this->et_rate = $t[0][2];
    }
}